﻿using System;

namespace Operations
{
    public abstract class CommonOpertation : IOperation
    {
        public OperationProcessor Processor { get; set; }

        public bool CanExecute(out string error)
        {
            CanExecute();
            return (error = Error) == null;
        }

        public virtual void CanExecute()
        {
        }

        public abstract void Execute(Delegate callback);

        protected string Error { get; private set; }

        protected void SetError(string error)
        {
            Error = error;
        }
    }
}